package com.SampleCodes.day4;

public class ConsoleMain {

	public static void main(String[] args) {
		 Dog moonMoon = new Dog();
		
		 int num1 = 5;
		 int num2 = 5;
		 moonMoon.eat();
		 moonMoon.breath("kamote");
		 moonMoon.walk();
		
		 System.out.println(moonMoon.isEqual(num1, num2));
		 System.out.println(moonMoon.isGreater(num1, num2));
		 System.out.println(moonMoon.isLess(num1, num2));
		 
		 
		 
		 //Exceptions
		 try {
		 int x = Integer.parseInt(args[0]);
		 int y = 3 / 0;
		 } catch (ArithmeticException ex) {
		 System.out.println("Divisor was zero.");
		 } catch (ArrayIndexOutOfBoundsException e) {
		 System.out.println("ERROR: Missing Argument.");
		 }
		System.out.println("After exception");
		try {
			for (int i = 1; i <= 5; i++) {
				myMethod(3);
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println("dsadasdas");
			System.out.println(e.getMessage());
		}
	}

	private static void myMethod(int n) {
		switch (n) {
		case (1):
			System.out.println("Case 1");
			return;
		case (3):
			System.out.println("Case 3");
			int x = 3 / 0;
			return;
		case (4):
			System.out.println("Case 4");
			return;
		case (2):
			System.out.println("Case 2");
		case (5):
			System.out.println("Case 5");
			throw new RuntimeException("thrown error");
		}

	}

}
